package org.jugile.util;

/*

Copyright (C) 2007-2011 Jukka Rahkonen  email: jukka.rahkonen@iki.fi

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

*/


/**
 * "And every creature which is in heaven, and on the earth, and under the earth, 
 *  and such as are in the sea, and all that are in them, heard I saying, Blessing, 
 *  and honour, and glory, and power, be unto him that sitteth upon the throne, 
 *  and unto the Lamb for ever and ever.
 *  And the four beasts said, Amen. And the four and twenty elders fell down and 
 *  worshipped him that liveth for ever and ever." (Rev 5:13-14)
 * 
 * ==========
 * 
 * Interface for any domain object. 
 * @author jukka.rahkonen@iki.fi
 */
public interface IDO {
	/**
	 * @return id as string
	 */
	public String getId();
	
	/**
	 * @return internal id as long. Use this for hash key in Maps.
	 */
	public long id();

	/**
	 * @return DOH Domain Object Handle, which contains object type and optionally home.
	 */
	public DOH getDoh();
	
	public boolean equals(IDO o);
	public int hashCode();

	public void delete();
	/**
	 * Data sync should not allways call onDelete method on reading node.
	 * @param ondelete should this call onDelete callback.
	 */
	public void delete(boolean ondelete);
	
	/**
	 * Tests if object matches given specification object.
	 * @param spec
	 * @return
	 */
	public boolean matches(Object spec);
	
	/**
	 * @param lang = fi,sv,...
	 * @return All text that should be indexed from this object for generic text search.
	 */
	public String txtIdx(String lang);

}
